doctype html
html.playbody
  head
    meta(charset="utf-8")
    meta(name="viewport",content="width=device-width, initial-scale=1, maximum-scale=1")
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
    link(rel="stylesheet", href='/stylesheets/DPlayer.min.css')
  body.playbody
    #player
    script(src="/javascripts/hls.min.js")
    script(src="/javascripts/DPlayer.min.js")
    script.
      function getParentUrl() {   
         var url = null;  
         if (parent !== window) {   
             try {  
                url = parent.location.href;   
             }catch (e) {   
                url = document.referrer;   
             }   
          }  
          return url;  
      }
      var parenturl = getParentUrl();
      var antiurl = "#{antiurl}";
      if(antiurl != ""){
        if(parenturl != null && parenturl.indexOf("#{antiurl}")==0){
          var dp = new DPlayer({
              container: document.getElementById('player'),
              screenshot: true,
              lang:  'zh-cn',
              autoplay: false,
              mutex: true,
              video: {
                  url: '/videos/#{id}/index.m3u8?token=#{token}',
                  pic: '/videos/#{id}/1.jpg',
                  type: 'hls'
              },
              subtitle: {
                  url: '/videos/#{id}/1.vtt',
                  fontSize: '25px',
                  bottom: '10%'
              }
          });
        }
      } else {
        var dp = new DPlayer({
            container: document.getElementById('player'),
            screenshot: true,
            lang:  'zh-cn',
            autoplay: false,
            mutex: true,
            video: {
                url: '/videos/#{id}/index.m3u8?token=#{token}',
                pic: '/videos/#{id}/1.jpg',
                type: 'hls'
            },
            subtitle: {
                url: '/videos/#{id}/1.vtt',
                fontSize: '25px',
                bottom: '10%'
            }
        });
      }
      